﻿@page "/user-page"

<MudContainer Class="mt-8">    
    <MudText>This snippet hasn't been compiled yet.</MudText>
    <MudText>Run the code on the left to see the result here.</MudText>
    <MudText Typo="@Typo.h6" Class="mt-12">How to load your own service</MudText>
    <MudText Class="mt-3">
        To install a service which your snippet can use create a new *.cs file, <br/>
        define a <code class="mud-primary-text">class UserStartup</code> with a <code class="mud-primary-text">public static void Configure(WebAssemblyHostBuilder builder)</code>. 
    </MudText>
    <br/>
    <MudText>Here is an example. Note the required usings!</MudText>
    <pre class="mt-6">
namespace Try.UserComponents
{
    using System;
    using System.Collections.Generic;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;

    // required using for UserStartup:
    using Microsoft.AspNetCore.Components.WebAssembly.Hosting;
    using Microsoft.Extensions.DependencyInjection;

    public class UserStartup
    {
        public static void Configure(WebAssemblyHostBuilder builder) {
            builder.Services.AddSingleton(new MyService());
        }
    }

    // your service
    public class MyService {     
        public string Hello() => "Hello World from MyService!";
    }

}
    </pre>
</MudContainer>


